/*
 * Copyright (C) 2025 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package top.xbaistack.common;

/**
 * 通信的状态码描述枚举类，用于统一定义各种状态码和相关描述信息。
 *
 * @author tangxbai
 * @since 2023/03/25
 */
public enum Code {

    FAIL(-1, "Error"),
    HEARTBEAT(100, "心跳检测"),

    OK(200, "OK"),
    TIPS(210, "操作成功"),

    PARAM_INVALID(400, "请求参数错误"),
    ;

    private int code;
    private String msg;

    Code(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int code() {
        return code;
    }

    public String message() {
        return msg;
    }

}
